package com.atguigu.gmall.web.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.feign.order.OrderFeignClient;
import com.atguigu.gmall.order.vo.OrderConfirmVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author:ahang
 * @create:2022-10-23 1:42
 * @Description:
 */

@Controller
public class OrderController {

    @Autowired
    OrderFeignClient orderFeignClient;

    @GetMapping("/trade.html")
    public String orderConfirmPage(Model model){
        //远程调用订单接口
        Result<OrderConfirmVo> data = orderFeignClient.getOrderConfirmdata();
        OrderConfirmVo confirmVo = data.getData();

        model.addAttribute("detailArrayList",confirmVo.getDetailArrayList());
        model.addAttribute("totalNum",confirmVo.getTotalNum());
        model.addAttribute("totalAmount",confirmVo.getTotalAmount());
        model.addAttribute("userAddressList",confirmVo.getUserAddressList());
        model.addAttribute("tradeNo",confirmVo.getTradeNo());

        return "order/trade.html";
    }
}
